//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<CFont10.h>
///	@path	~/src/graphics/dx10/
///	@date	2008/12/20
///	@desc	.

#pragma once

#include "xeres.h"

#include "lib/math/color.h"

#include "graphics/IFont.h"
#include "graphics/dx10/CDevice10.h"

#include <d3dx10.h>

namespace xeres {

	/*!
		\class	CFont10
		\brief	DirectX 9 fonts implementation.
	*/
	class CFont10 : public IFont
	{
	public:

		/// \ctor
		CFont10( ID3DX10Font * pFont );

		/// \dtor
		virtual ~CFont10( void );

		DECL_IOBJECT_CLASS( CFont10 , IFont );

	public:

	//@ interface

		/*!
			\brief		Called when device is lost or before reset.
		*/
		virtual bool OnLostDevice( void );

		/*!
			\brief		Called after device is reset.
		*/
		virtual bool OnResetDevice( RefWeak<IDevice> device );

		/*!
			\brief		Get text rendering context.
		*/
		virtual void * GetDC( void );

		/*!
			\brief		Draw text use fonts.
		*/
		virtual int DrawText( RefWeak<ISprite> sprite , const WString& text ,
			int rect[4] , int style , PackColor4 color );

	//@ local method

		/*!
			\brief		Get raw interface.
		*/
		ID3DX10Font * GetFont( void ) const { return m_pFont; }

		/*!
			\brief		Draw text with known interface sprite.
		*/
		int DrawTextX( ID3DX10Sprite * D3DX_sprite , const WString& text ,
			int rect[4] , int style , DWORD color );

	private:

	//@ data
		
		// font interface
		ID3DX10Font *		m_pFont;

	};


} // namespace xeres
